#if !defined(__APP_DEVICE_H)
#define __APP_DEVICE_H

#include "app_buffer.h"
#include <pthread.h>

typedef struct 
{
    char *filename;
    int fd;
    Buffer *up_buffer;
    Buffer *down_buffer;
    pthread_t read_thread;
    int is_running;
    long last_write_time;
    int (*post_read)(char *data,int len);
    int (*pre_write)(char *data,int len);
} Device;

// 初始化设备
Device *app_device_init(char *filename);

// 启动设备
int app_device_start();

// 销毁设备
void app_device_destroy();

#endif // __APP_DEVICE_H
